
<!doctype html>

<html>

<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf08" />
  <title>Basis Source Viewer</title>

  <link rel="stylesheet" type="text/css" title="Default Style" href="../style/highlight/style.css" media="screen" />

  <script type="text/javascript" src="../basis-all.js"></script>

  <style type="text/css">
    BODY
    {
      color: black;
      font-size: small;
    }
    .selected
    {
      background: gold !important;
    }
  </style>
</head>

<body>
  <script type="text/javascript">
    var line = parseInt((location.hash || '').replace(/^#/, ''));
    var filename = ((location.search || '').match(/[\?\&]file=([^&]+)/) || [])[1];
    if (filename)
    {
      var transport = new basis.net.ajax.Transport({
        url: '../' + filename,
        event_complete: function(req){
          this.constructor.prototype.event_success.apply(this, arguments);

          //t = new Date;
          var node = new basis.format.highlight.SourceCodeNode({
            container: document.body,
            lang: 'js',
            normalize: false,
            data: {
              code: req.responseText//.replace(/^\s*\n/, function(m){ return '.' + m })
            }
          });

          //alert(new Date - t)
          if (!isNaN(line))
          {
            var lineElement = node.element.childNodes[line - 1];
            if (lineElement)
            {
              lineElement.className += ' selected';
              setTimeout(function(){
                document.documentElement.scrollTop =
                document.body.scrollTop = lineElement.offsetTop - 200;
              }, 15);
            }
          }
        }
      });
      transport.get();
    }
  </script>
</body>

</html>